<?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

/* JoomLeague League Management and Prediction Game for Joomla!
 * Copyright (C) 2007  Robert Moss
 *  
 * Homepage: http://www.joomleague.de
 * Support: htt://www.joomleague.de/forum/
 * 
 * This file is part of JoomLeague.
 *  
 * JoomLeague is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * Please note that the GPL states that any headers in files and
 * Copyright notices as well as credits in headers, source files
 * and output (screens, prints, etc.) can not be removed.
 * You can extend them with your own credits, though...
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 * The "GNU General Public License" (GPL) is available at
 * http://www.gnu.org/copyleft/gpl.html.
*/ 

require_once "$mosConfig_absolute_path/components/com_joomleague/joomleague.js.php";?>

<a name="jl_top" id="jl_top"></a>
<!-- Header with Project Name-->
<?php if ($results_config['show_project_heading'] == "1" OR 
    $overall_config['show_project_heading'] == "1" OR $table_config['show_project_heading'] == "1") { ?>
<div class="componentheading" <?php if ($results_config['show_print_button'] == "1" OR
      $overall_config['show_print_button'] == "1" OR $table_config['show_print_button'] == "1") echo 'style="float:left;"';
      ?>><?php echo HTML_joomleague::showTitle($project, $overall_config['project_heading_type']); ?></div>
<!-- Druckfunktion -->
<?php if ($results_config['show_print_button'] == "1" OR $overall_config['show_print_button'] == "1" OR $table_config['show_print_button'] == "1") {
HTML_joomleague::PrintIcon( $row, $params, false, '' );
};?>
<!-- Druckfunktion Ende -->
<?php } ?>
<!-- Header END -->

<!-- section header e.g. ranking, results etc. -->

<?php 
if ($results_config['show_events']==1) { HTML_joomleague::init_tabs(); }
if ($mytask=="edit"&&($allowed==1||(in_array($my->id, $alloweds)&&$my->id>0))) {
	require_once "$mosConfig_absolute_path/components/com_joomleague/js/JL_eventsediting.js.php";
//	HTML_joomleague::init_edit_events();
	HTML_joomleague::start_edit_form($current_round);
}
?>
<table width="100%" class="contentpaneopen">
	<tr>
		<td class="contentheading">
		<?php
      if ($results_config['show_section_heading']==1)
      HTML_joomleague::show_matchdays_title(_JL_RESULTS, $rounds[$current_round-1]->id, $results_config);
	    if ($allowed==1||($allowed==1||(in_array($my->id, $alloweds)&&$my->id>0))) {
      HTML_joomleague::show_edit_icon();}
		?>
		</td>
<?php 
if ($allowed==1) {
if ($mytask=="edit"&&$project->current_round_auto==0) {
  echo '<td align="right"><b>'._JL_RESULTS_SET_MATCHDAY.'</b>'.$project->roundsdropdown($current_round, count($rounds)).'</td>';
  }
  else echo '<td align="right">'._JL_MATCHDAYS_SELECT.$pageNav2.'</td>';
}
else    
// select navigation of matchdays for browsing mode START
if (isset($pageNav2)&&$mytask!="edit"&&$results_config['show_matchday_dropdown']==1) echo '<td align="right">'._JL_MATCHDAYS_SELECT.$pageNav2.'</td>';
// select navigation of matchdays for browsing mode ENDS    
?>		
    </tr>
</table>
<br />
<!-- section header ends -->
<?php
if ($results_config['show_events']==1&&$results_config['use_tabs_events']==1) { HTML_joomleague::init_tabs(); }
if ($mytask=="edit"&&($allowed==1||($allowed==1||(in_array($my->id, $alloweds)&&$my->id>0)))) {
	HTML_joomleague::init_edit_events();
	HTML_joomleague::start_edit_form($current_round);
}
?>
<!-- Main START -->
<table width="96%" align="center" border="0" cellpadding="3" cellspacing="0">

<?php
// this shows the matches (DO NOT DISABLE) START
HTML_joomleague::show_results($matches, $results_config);
// this shows the matches (DO NOT DISABLE) ENDS
?>
</table>

<!-- Main END -->
<?php
if ($mytask=="edit"&&($allowed==1||($allowed==1||(in_array($my->id, $alloweds)&&$my->id>0)))) {
?>
<input type="hidden" class="button" name="save_data" value="1" />
</form>
<?php
HTML_joomleague::close_edit_events($mdd);
}
if ($results_config['show_dnp_teams'] == 1) {
  echo '<div style="text-align:center">';
  HTML_joomleague::show_not_playing_teams($playing_teams, $teams_in_league, $results_config);
  echo '</div>';
}
if (isset($pageNav)&&$results_config['show_matchday_pagenav']==1) { ?>
<!-- Matchdays Output  -->
<table width="96%" align="center" border="0" cellpadding="3" cellspacing="0">
  <tr>
   <td align="center"><br /><?=$pageNav ?></td>
  </tr>
</table>
<br />
<!-- Matchdays Output END -->
<? } ?>
<!-- section header e.g. ranking, results etc. -->

<?php if ($table_config['show_section_heading']==1) { ;?>
<table class="contentpaneopen" width="100%">
 	<tr>
   <td class="contentheading">
<?php printf(_JL_TABLE_ALL);
HTML_joomleague::show_matchdays_title(_JL_TABLE, $rounds[$current_round-1]->id, $table_config);?>
</td>
	</tr>
</table>
<?php } ;?>
<!-- section header ends -->

<br />

<!-- ranking START -->
<?php

foreach ( $current_ranking as $key=>$cu_rk ) {
  if ($key) {
    echo '<table width="96%" align="center" border="0" cellpadding="3" cellspacing="0"><tr><td class="contentheading">';
      HTML_joomleague::show_ranking_division_title($key);
    echo '</td></tr></table>';
  }
  ?>
  <table width="96%" align="center" border="0" cellpadding="3" cellspacing="0">
  <?php
  HTML_joomleague::show_ranking_heading($table_config);
  HTML_joomleague::show_ranking_entries($cu_rk, $previous_ranking[$key], array(), array(), $table_config);
  ?>
  </table><br/>
  <?php
}
?>

<!-- ranking END -->
<!-- colors legend START -->
<?php if ($table_config['show_colors_legend']==1){;?>
<br />
<table width="96%" align="center" cellpadding="3" cellspacing="0">
  <tr>
      <?php
       HTML_joomleague::show_colors_legend();
      ?>
  </tr>
</table>
<?php };?>
<!-- colors legend END -->
<!-- if available points manipulations with explanations START -->
<?php
HTML_joomleague::show_manipulations ($result);
 ?>
<!-- if available points manipulations with explanations END -->

<!-- matchdays pageNav -->
<?php
if (isset($pageNav)&&$table_config['show_matchday_pagenav']==1) { ?>
<table width="96%" align="center" border="0" cellpadding="3" cellspacing="0">
  <tr>
   <td align="center">
   <br />
   <?=$pageNav ?>
<br /></td>
  </tr>
</table>
<?php
} ?>
<!-- Amatchdays pageNav END -->

<!-- Print Button START -->
<?php if ($results_config['show_back_button'] > 0 OR $overall_config['show_back_button'] > 0 OR $table_config['show_back_button'] > 0) {;?>
<?php if ($results_config['show_back_button'] == "1" OR $overall_config['show_back_button'] == "1" OR $table_config['show_back_button'] == "1") echo '<div align="left">'; else echo '<div align="right">';?>
<?php
$params = & new mosParameters( '' );
$params->def( 'back_button', true );
$params->def( 'popup', false );
mosHTML::BackButton( $params );
?></div> 
<?php };?>
<!-- Print Button END -->

